<?php
namespace App\Model\Movie;
use PhalApi\Model\DataModel;

class Advertisement extends DataModel {

    protected function getTableName($id) {
        return 'advertisement';
    }

    public function getList() {
        $res = $this->getORM()->select('*')->fetchAll();
        return $res;
    }
    public function searchList($domain) {
        $res = $this->getORM()->where(['domain'=>$domain])->select('*')->fetchAll();
        return $res;
    }
    public function getDomains() {
        $res = $this->getORM()->select('domain')->fetchAll();
        return $res;
    }
    public function getDomain($domain) {
        $res = $this->getORM()->select('domain')->where('domain',$domain)->fetchOne();
        return $res;
    }
    public function getChildrenSourceId($pid){
        $res = $this->getORM()->select('name','source_id')->where('pid',$pid)->fetchAll();
        return $res;
    }
}